package fly.text;

import fly.help.PrintSupport;

import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;

public class NumberFormatDemo {

    public static void main(String[] args) {
        PrintSupport.sout("1");
        NumberFormat nf = NumberFormat.getInstance();
        System.out.println( nf.format(1222));
        System.out.println( nf.format(01222)); //8进制
        System.out.println( nf.format(1.222));
        System.out.println( nf.format(1.2220));//去除小数末尾0

        PrintSupport.sout("2");
        NumberFormat nfl = NumberFormat.getInstance(Locale.US);
        try {
            System.out.println(nfl.parse("2.3031"));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        System.out.println(nfl.format(1324132L));
    }
}
